package com.qianlima.upload.common.enums;

import lombok.Getter;

/**
 * @description:
 * @author：allms
 * @date: 2023/3/22 16:57
 */
@Getter
public enum FileUseEnum {

    /**
     * 大文件
     */
    BIG("B", "big"),
    /**
     * 小文件
     */
    SMALL("S", "small");

    private String code;

    private String desc;

    FileUseEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static FileUseEnum getByCode(String code) {
        for (FileUseEnum fileUseEnum : FileUseEnum.values()) {
            if (code.equals(fileUseEnum.getCode())) {
                return fileUseEnum;
            }
        }
        // 默认小文件
        return SMALL;
    }
}
